from flask import Flask, render_template
import sqlite3
from flask import g
from api import api
DATABASE = 'database.db'

app = Flask(__name__,static_folder="static",template_folder="templates")
app.register_blueprint(api, url_prefix='/api')
def get_db():
    db = getattr(g, '_database', None)
    if db is None:
        db = g._database = sqlite3.connect(DATABASE)
    return db
@app.teardown_appcontext
def close_connection(exception):
    db = getattr(g, '_database', None)
    if db is not None:
        db.close()

@app.route("/")
def hello():
    return render_template('main.html')
@app.route("/test")
def test():
    return render_template('test.html')
if __name__ == "__main__":
    
    app.run(debug=True)